//
//  UIView+Layout.m
//  Traffic
//
//  Created by CruItaly on 2017/10/28.
//  Copyright © 2017年 com.infohold.cn. All rights reserved.
//

#import "UIView+Layout.h"

@implementation UIView (Layout)

@dynamic x;
@dynamic y;
@dynamic w;
@dynamic h;

- (void)setX:(CGFloat)x{
    CGRect rect = self.frame;
    rect.origin.x = x;
    self.frame = rect;
}

- (CGFloat)x{
    return self.origin.x;
}

- (void)setY:(CGFloat)y{
    CGRect rect = self.frame;
    rect.origin.y = y;
    self.frame = rect;
}

- (CGFloat)y{
    return self.origin.y;
}

- (void)setW:(CGFloat)w{
    CGRect rect = self.frame;
    rect.size.width = w;
    self.frame = rect;
}

- (CGFloat)w{
    return self.size.width;
}

- (void)setH:(CGFloat)h{
    CGRect rect = self.frame;
    rect.size.width = h;
    self.frame = rect;
}

- (CGFloat)h{
    return self.size.height;
}
- (void)setSize:(CGSize)size{
    CGRect rect = self.frame;
    rect.size = size;
    self.frame = rect;
}

- (CGSize)size{
    return self.frame.size;
}

- (void)setOrigin:(CGPoint)origin{
    CGRect rect = self.frame;
    rect.origin = origin;
    self.frame = rect;
}
- (CGPoint)origin{
    return self.frame.origin;
}
@end
